﻿namespace Digitalmes.Application.Sys.Users.Commands;

/// <summary>
/// 删除用户命令。
/// </summary>
public record DeleteUserCommand(long Id) : IRequest<IResult<bool>>;

internal sealed class DeleteUserCommandHandler(IRepository<SysUser> repo) : IRequestHandler<DeleteUserCommand, IResult<bool>>
{
    public async Task<IResult<bool>> Handle(DeleteUserCommand request, CancellationToken cancellationToken)
    {
        var ok = await repo.DeleteByIdAsync(request.Id, cancellationToken);
        return Result.From(ok);
    }
}
